/**
 * FileName: InitController
 * Author:   zhen
 * Date:     2021/8/26 19:11
 * Description: 控制层
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.zhen.controller;

import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhen
 */
@RestController
@Slf4j
public class InitController {
    private static final Logger logInfo = LoggerFactory.getLogger(InitController.class);

    @GetMapping("/init")
    public String init() {
        Map<String, Object> params = new HashMap<>();
        params.put("name","zhangsan");
        String info = JSONObject.toJSONString(params);
        logInfo.info("params转换成json后的数据是info:{}", info);
        log.info("使用lombok的注解@Slf4j实现快速打印日志");
        return "init springboot";
    }
}